<template>
  <div class="index.vue">
    <div class="w">
      <div class="brief_content_box">
        <div class="brief_content_right">
          <div>
            <crumbs
              :padd="'0'"
              :navList='navList'
              @handSonNav="handSonNav"
            >
              <wDynamic
                :sonList="sonList"
                v-if="id1==activeId"
                :count="count"
              ></wDynamic>
              <miens
                :sonList="sonList"
                v-if="id2==activeId"
                :count="count"
              ></miens>
              <staffHome
                :sonList="sonList"
                v-if="id3==activeId"
                :count="count"
              ></staffHome>
            </crumbs>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import zdyBtn from "@/components/zdyBtn.vue";
import rightNav from "@/components/rightNav.vue";
import crumbs from "@/components/crumbs.vue";
import wDynamic from "./components/wDynamic";
import miens from "./components/miens";
import staffHome from "./components/staffHome";

export default {
  components: {
    zdyBtn,
    rightNav,
    crumbs,
    wDynamic,
    miens,
    staffHome
  },
  name: "index.vue",

  data() {
    return {
      activeId: "0",
      navList: [],
      id1: "",
      id2: "",
      id3: "",
      sonList: [],
      count: 0
    };
  },
  created() {
    this.$api
      .getPermissionOne({
        parentId: this.$route.query.id,
        page: 1,
        limit: 10
      })
      .then(res => {
        this.navList = res.data.data;
        this.id1 = this.navList[0][0].sortId;
        this.activeId = this.id1;
        this.id2 = this.navList[1][0].sortId;
        this.id3 = this.navList[2][0].sortId;
        this.handSonNav(this.id1);
      });
  },
  methods: {
    handSonNav(id, page, limit) {
      this.activeId = id;
      // parentId=28&page=1&limit=2
      if (this.activeId == "28") {
        this.$api
          .getHome({
            parentId: id,
            page: page == undefined ? "1" : page,
            limit: 10
          })
          .then(res => {
            console.log(res, "职工之家");
            this.sonList = res.data.data;
          });
      } else {
        this.$api
          .getList({
            sortId: id,
            page: 1,
            limit: 8
          })
          .then(res => {
            this.sonList = res.data.data;
            this.sonList.forEach(item => {
              item.img = item.img.replace(/\\/g, "/");
              // this.$store.commit("handBus", false);
              this.count = parseInt(res.data.count);
            });
          });
      }
    }
  }
};
</script>

<style lang='scss' scoped>
.brief_content_box {
  // display: flex;
  margin-top: 10px;
  .brief_content_left {
    width: 261px;
    background: rgba(255, 255, 255, 1);
    .brief_left_serve {
      margin-top: 20px;
      .serve_box {
        border: 1px solid rgba(204, 204, 204, 1);
        border-top: 0;
        padding: 40px 29px 0 29px;
        .the_phone {
          display: flex;
          align-items: center;
          margin-top: 38px;
          margin-bottom: 40px;
          .the_phone_off {
            width: 53px;
            height: 1px;
            // border: 1px solid rgba(204, 204, 204, 1);
            background-color: rgba(204, 204, 204, 1);
          }
          .the_phone_title {
            font-size: 14px;
            font-weight: 400;
            margin-right: 10px;
            margin-left: 10px;
            color: rgba(128, 128, 128, 1);
          }
        }
        .serve_phone_box {
          display: flex;
          align-items: center;
          .phone_num_box {
            margin-left: 21px;
            .phone_num {
              color: #808080;
              font-size: 18px;
            }
          }

          .serve_phone {
            width: 51px;
            height: 51px;
            background: rgba(255, 255, 255, 1);
            border: 2px solid rgba(18, 150, 219, 1);
            border-radius: 50%;
            position: relative;
            .phone_img {
              width: 25px;
              height: 25px;
              position: absolute;
              top: 50%;
              left: 50%;
              margin-top: -12.5px;
              margin-left: -12.5px;
            }
          }
        }
      }
    }
    .brief_left_content {
      // height: 162px;
      border: 1px solid rgba(204, 204, 204, 1);
      border-top: 0;
      width: 100%;
      padding-right: 13px;
      padding-left: 13px;
      .content_list {
        margin-bottom: 20px;
        .content_item {
          width: 100%;
          padding-top: 15px;
          padding-bottom: 15px;
          border-bottom: 1px solid #eeeeee;
          text-align: center;
          color: #333333;
          font-size: 16px;
        }
      }
    }
  }
}
</style>
